/*
 * FtpTest.cpp
 *
 *  Created on: 2012-12-26
 *      Author: yangentao@gmail.com
 */

#include <iostream>
#include "FtpTest.h"
#include "TaskQueue.h"
#include "../yet/net/SocketMonitor.h"
#include "../yet/WinLoop.h"

namespace ftp {
using namespace yet;

void ftptest(){
	FtpContext c;
	TaskQueue q(&c);

	q.appendTask()->connect("127.0.0.1", 21);
	q.appendTask()->login("yet", "19810218");
	q.appendTask()->syst();
	q.appendTask()->type("A");
	q.appendTask()->help();
	q.appendTask()->feat();
	q.appendTask()->pasv();
//	q.appendTask()->nlst();
	q.appendTask()->list();
	q.appendTask()->quit();
	q.execute();
	if(c.nlstDataOK){
		vector<string> items = c.getNlstItems();
		for(int i=0; i< items.size(); ++i){
			cout<<items[i]<<endl;
		}
	}
}

} /* namespace yet */
